package com.analog.mserver.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.analog.mserver.common.RestResult;
import com.analog.mserver.service.user.UserService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@Api("IndexController相关的api")
@RefreshScope
public class IndexController {
	
	@Autowired
	private UserService userService;
	
	@ApiOperation(value = "login", notes = "login")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "path")
	})
	@GetMapping("token/verification/{token}")
	public RestResult login(@PathVariable String token) {
		boolean f = userService.verificationToken(token);
		if(f) {
			return new RestResult("登录成功");	
		}else {
			return new RestResult("2","token 过期请重申登录！");
		}
	}
	
	
}
